<?php

class Application_Form_CoursesType extends Validation_Form {

	public function init(){
		
		$this->setName("zendForm");
		$this->setMethod('post');
		$id = new Zend_Form_Element_Hidden('id');
		$id->addFilter('Int');
		$coursesType = $this->createElement('text', 'designation');
		$typeForm = $this->createElement('hidden','typeForm');
		$coursesType->setLabel('Rodzaj zajęć')
		->setRequired(TRUE)
		->setAttrib('size', 30)
		->addFilters(array(
		new Zend_Filter_StringTrim(),
		new Zend_Filter_StripNewlines(),
		new Zend_Filter_StripTags()
		))
		->addValidators(array(
		new Zend_Validate_NotEmpty(),
		new Zend_Validate_StringLength(array('min' => 5, 'max' => 30)),
		//new Zend_Validate_Alpha()
		));
		$short = $this->createElement('text', 'short');
		$short->setLabel('Skrót')
		->setRequired(TRUE)
		->setAttrib('size', 30)
		->addFilters(array(
		new Zend_Filter_StringTrim(),
		new Zend_Filter_StripNewlines(),
		new Zend_Filter_StripTags()
		))
		->addValidators(array(
		new Zend_Validate_NotEmpty(),
		new Zend_Validate_StringLength(array('min' => 2, 'max' => 10)),
		//new Zend_Validate_Alpha()
		));
		$durationCourse = $this->createElement('text', 'duration_course');
    	$durationCourse->setLabel('Czas trwania')
            ->setRequired(TRUE)
            ->setAttrib('size', 30)
            ->addFilters(array(
                new Zend_Filter_StringTrim(),
                new Zend_Filter_StripNewlines(),
                new Zend_Filter_StripTags()
            ))
            ->addValidators(array(
                new Zend_Validate_NotEmpty(),
                //new Zend_Validate_StringLength(array('min' => 2, 'max' => 30)),
                //new Zend_Validate_Alpha()
            ));	
		$submit = new Zend_Form_Element_Submit('submit');
		$submit->setAttrib('id', 'submit');

		$this->addElements(array(
		$id,
		$coursesType,
		$short,
		$durationCourse,
		$typeForm,
		$submit,
		));
	}


}
?>
